package cn.jwelll.bxcstock.ui.view

import android.content.Context
import android.os.Build
import android.support.v7.widget.RecyclerView
import android.text.Html
import android.util.AttributeSet
import android.view.View
import cn.jwelll.bxcstock.R
import cn.jwelll.bxcstock.ui.adapter.CommonRecyclerAdapter
import cn.jwelll.bxcstock.ui.dialog.DialogUtils
import cn.jwelll.bxcstock.viewmodel.itemmodel.ItemCarInUploadModel
import kotlinx.android.synthetic.main.item_carin_two.view.*

class MyRecyclerView : RecyclerView {

    constructor(context: Context) : super(context)
    constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
    constructor(context: Context, attrs: AttributeSet?, defStyle: Int) : super(context, attrs, defStyle)

    override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
        val expandSpec = View.MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE shr 2, View.MeasureSpec.AT_MOST)
        super.onMeasure(widthMeasureSpec, expandSpec)
    }

//    var itemCarinThree: ItemCarInUploadModel? = null
//        set(value) {
//            field = value
//            value?.childList.let {
//                if (it!!.isNotEmpty()) {
//                    adapter = CommonRecyclerAdapter(context, R.layout.item_carin_two, it) { itemView, t, i ->
//                        itemView.tv_delete.setOnClickListener {
//                            var charSequence: CharSequence = ""
//                            var value = "你确定要删除捆包<font color=\"#222222\">${t?.dataCode}</font>吗？"
//                            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
//                                charSequence = Html.fromHtml(value, Html.FROM_HTML_MODE_COMPACT)
//                            } else {
//                                charSequence = Html.fromHtml(value)
//                            }
//                            DialogUtils.Builder(context).setTitle("提示").setMessage(charSequence)
//                                .setNegativeButton("取消", R.color.color_999999, null)
//                                .setPositiveButton("确定", R.color.color_2d5aff) {
//                                }
//                                .creat().show()
//                        }
//                    }
//                }
//            }
//        }

}